package com.example.unisys.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.unisys.entity.Student;
import com.example.unisys.dao.StudentMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class StudentService extends ServiceImpl<StudentMapper,Student> {


    public int insert(Student stu) {
        return baseMapper.insert(stu);
    }

    public int insertSelective(Student stu) {
        return baseMapper.insertSelective(stu);
    }

    public int update(Student stu) {
        return baseMapper.update(stu);
    }

    public int updatetag(long exam_id, String newtag) {
        return baseMapper.updatetag(exam_id, newtag);
    }


    //根据分页获取

    public List<Student> getSysStu(int start, int page) {
        return baseMapper.getSysStu(start, page);
    }

    public Integer getStuNum(String main_school, String sub_school) {
        return baseMapper.getStuNum(main_school, sub_school);
    }

    public Integer getMainStuNum(String main_school) {
        return baseMapper.getMainStuNum(main_school);
    }

    public Integer getAllStuNum() {
        return baseMapper.getAllStuNum();
    }

    public List<Student> getAllStudent(int start, int pagesize, String main_school, String sub_school) {
        return baseMapper.getAllStudent(start, pagesize, main_school, sub_school);
    }

    public Integer getTagNum(String tag, String main_school, String sub_school) {
        return baseMapper.getTagNum(tag, main_school, sub_school);
    }

    public List<Student> getByTag(String tag, int start, int pagesize, String main_school, String sub_school) {
        return baseMapper.getByTag(tag, start, pagesize, main_school, sub_school);
    }

    public List<Student> getByPhone(String phone) {
        return baseMapper.getByPhone(phone);
    }

    public Student getByIdcard(String id_card, String main_school, String sub_school) {
        return baseMapper.getByIdcard(id_card, main_school, sub_school);
    }

    public List<Student> getByName(String real_name) {
        return baseMapper.getByName(real_name);
    }

    public Student getById(String exam_id) {
        return baseMapper.getById(exam_id);
    }


    public List<Student> getByPhoneMain(String phone, String main_school) {
        return baseMapper.getByPhoneMain(phone, main_school);
    }

    public List<Student> getByNameMain(String real_name, String main_school) {
        return baseMapper.getByNameMain(real_name, main_school);
    }

    public List<Student> getMainStu(String main_school, int start, int page) {
        return baseMapper.getMainStu(main_school, start, page);
    }

    public List<Student> getSubStu(String main_school, String sub_school, int start, int page) {
        return baseMapper.getSubStu(main_school, sub_school, start, page);
    }

    public int delete(String exam_id) {
        return baseMapper.delete(exam_id);
    }

    public Student getByUsername(String username) {
        return baseMapper.getByUsername(username);
    }

    public List<Student> getByMainTag(String tag, String main_school, int start, int pagesize) {
        return baseMapper.getByMainTag(tag, main_school, start, pagesize);
    }

    public Integer getByMainTagSum(String tag, String main_school) {
        return baseMapper.getByMainTagSum(tag, main_school);
    }

    public String getPassword(Map map) {
        Student stu = baseMapper.getPassword(map);
        if (stu == null)
            return "";
        else
            return stu.getPassword();
    }


    public Student searchStudent(HashMap<String, Object> hs) {
        return baseMapper.searchStudent(hs);
    }

    public List<Student> getSystemStudents(HashMap<String, Object> hs) {
        return baseMapper.getSystemStudents(hs);
    }

    public List<Student> getSystemStudentsByTag(HashMap<String, Object> hs) {
        return baseMapper.getSystemStudentsByTag(hs);
    }

    public int getAllStuNumByTag(HashMap<String, Object> hs) {
        return baseMapper.getSysStuNumByTag(hs);
    }

    public List<Student> getSupervise(HashMap<String, Object> hs) {
        return baseMapper.getSystemSupervise(hs);
    }

    public Integer getStuSum(HashMap<String, Object> hs) {
        return baseMapper.getStuSum(hs);
    }

    public int getAllStuNumCurTag(HashMap<String, Object> hs) {
        return baseMapper.getAllStuCurTag(hs);
    }

    public List<Map<String, Object>> getSuperviseFile(HashMap<String, Object> hs) {
        return baseMapper.getSuperviseFile(hs);
    }

    public Integer getSystemSuperviseSum(HashMap<String, Object> hs) {
        return baseMapper.getSystemSuperviseSum(hs);
    }
}
